<script setup lang="tsx">
// 选择权益包模板
import useTable from "@/hooks/useTable";
import { ElDialog, ElTable, ElTableColumn } from "element-plus";
import ApiActivity from "@/api/activity";
import { TPackage } from "@/types/global";

// 权益包模板列表
const { list, pagination } = useTable<TPackage>(ApiActivity.packageList, {
  defaultSearch: { status: 1 },
});
const emits = defineEmits<{
  choosePackage: [event: number];
}>();
// const skuPackage = ref();
// 选中/取消某一项
const handleChoosePackage = (row: any) => {
  emits("choosePackage", row);
};
// 确认
// const handleConfirmChoosePackage = () => emits("choosePackage", skuPackage);
</script>

<template>
  <ElDialog title="请选择权益包模板">
    <ElTable ref="tableRef" :data="list" @row-click="handleChoosePackage">
      <!-- <ElTableColumn type="selection"></ElTableColumn> -->
      <ElTableColumn label="模板名称" prop="package_title"></ElTableColumn>
    </ElTable>
    <template #footer>
      <div class="flex justify-between">
        <!-- <ElButton type="primary" @click="handleConfirmChoosePackage">确认</ElButton> -->
        <ElPagination v-bind="pagination" />
      </div>
    </template>
  </ElDialog>
</template>
